package com.bjc.platform.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.bjc.platform.util.DateUtil;

@Entity
@Table(name = "adm_code")
public class AdmCode extends BaseObject implements Serializable {
	private static final long serialVersionUID = 3068665228335745112L;
	private Integer id;
	private String name;
	private String code;
	private Long parentId;
	private String accessType;
	private String discription;
	private String remark;
	private Long creator;
	private Date createTime;
	private Long updater;
	private Date updateTime;
	private Boolean flag;

	public AdmCode() {
	}

	public AdmCode(Integer id) {
		this.id = id;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@Column(name = "name", length = 20)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "code", length = 20)
	public String getCode() {
		return this.code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	@Column(name = "parent_id", columnDefinition="int")
	public Long getParentId() {
		return this.parentId;
	}

	public void setParentId(Long parentId) {
		this.parentId = parentId;
	}

	@Column(name = "access_type", length = 20)
	public String getAccessType() {
		return this.accessType;
	}

	public void setAccessType(String accessType) {
		this.accessType = accessType;
	}

	@Column(name = "discription", length = 150)
	public String getDiscription() {
		return this.discription;
	}

	public void setDiscription(String discription) {
		this.discription = discription;
	}

	@Column(name = "remark", length = 600)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@Column(name = "creator", nullable = false, columnDefinition="int")
	public Long getCreator() {
		return this.creator;
	}

	public void setCreator(Long creator) {
		this.creator = creator;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", length = 19)
	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	@Column(name = "updater", columnDefinition="int")
	public Long getUpdater() {
		return this.updater;
	}

	public void setUpdater(Long updater) {
		this.updater = updater;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time", length = 19)
	public Date getUpdateTime() {
		return this.updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	@Column(name = "flag")
	public Boolean isFlag() {
		return this.flag;
	}

	public void setFlag(Boolean flag) {
		this.flag = flag;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		AdmCode pojo = (AdmCode) o;

		if (name != null ? !name.equals(pojo.name) : pojo.name != null)
			return false;
		if (code != null ? !code.equals(pojo.code) : pojo.code != null)
			return false;
		if (parentId != null ? !parentId.equals(pojo.parentId)
				: pojo.parentId != null)
			return false;
		if (accessType != null ? !accessType.equals(pojo.accessType)
				: pojo.accessType != null)
			return false;
		if (discription != null ? !discription.equals(pojo.discription)
				: pojo.discription != null)
			return false;
		if (remark != null ? !remark.equals(pojo.remark) : pojo.remark != null)
			return false;
		if (creator != null ? !creator.equals(pojo.creator)
				: pojo.creator != null)
			return false;
		if (createTime != null ? !createTime.equals(pojo.createTime)
				: pojo.createTime != null)
			return false;
		if (updater != null ? !updater.equals(pojo.updater)
				: pojo.updater != null)
			return false;
		if (updateTime != null ? !updateTime.equals(pojo.updateTime)
				: pojo.updateTime != null)
			return false;

		return true;
	}

	public int hashCode() {
		int result = 0;
		result = (name != null ? name.hashCode() : 0);
		result = 31 * result + (code != null ? code.hashCode() : 0);
		result = 31 * result + (parentId != null ? parentId.hashCode() : 0);
		result = 31 * result + (accessType != null ? accessType.hashCode() : 0);
		result = 31 * result
				+ (discription != null ? discription.hashCode() : 0);
		result = 31 * result + (remark != null ? remark.hashCode() : 0);
		result = 31 * result + (creator != null ? creator.hashCode() : 0);
		result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
		result = 31 * result + (updater != null ? updater.hashCode() : 0);
		result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);

		return result;
	}

	public String toString() {
		StringBuilder sb = new StringBuilder(getClass().getSimpleName());

		sb.append(" [");
		sb.append("id").append("='").append(getId()).append("', ");
		sb.append("name").append("='").append(getName()).append("', ");
		sb.append("code").append("='").append(getCode()).append("', ");
		sb.append("parentId").append("='").append(getParentId()).append("', ");
		sb.append("accessType").append("='").append(getAccessType())
				.append("', ");
		sb.append("discription").append("='").append(getDiscription())
				.append("', ");
		sb.append("remark").append("='").append(getRemark()).append("', ");
		sb.append("creator").append("='").append(getCreator()).append("', ");
		sb.append("createTime").append("='").append(getCreateTime())
				.append("', ");
		sb.append("updater").append("='").append(getUpdater()).append("', ");
		sb.append("updateTime").append("='").append(getUpdateTime())
				.append("', ");
		sb.append("]");

		return sb.toString();
	}

}
